<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
<head>
	<base href="<%=basePath%>">

	<title>添加项目</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" href="<%=basePath%>css/index.css">

    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/bootstrap-select.js">
    </script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/bootstrap-select.css">
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        //2.得到页面上输入的值，插入到Project表中
        function insert(){
            var wname=document.getElementById("wname").value;
            var leader=document.getElementById("leader").value;
            if(wname.match(/^\s*$/) || leader.match(/^\s*$/)){
                alert("项目名称或者负责人为必填的");
                return;
            }
            var form1=document.getElementById("form1");
            form1.action="insertProject";
            form1.submit();
        }


        //得到下拉框中的值
        $(document).ready(function(){
            var array = new Array(); //定义数组
            $("option").each(function(){ //遍历全部option
                var txt = $(this).text(); //获取option的内容
                if(txt != "全部") //如果不是“全部”
                    array.push(txt); //添加到数组中
                //console.log(array);
            });
            //alert("array数组是："+array);
            //将array数组传到后台去
        });
        $(window).on('load', function () {
            $('.selectpicker').selectpicker({
                'selectedText': 'cat'
            });
        });

    </script>
</head>

<body>
<h2>添加项目</h2>
<form  method="post" id="form1">
	<table class="table_main">
		<tr>
			<td>项目组</td>
			<td>
				<select id="groups" name="groups">
					<c:forEach items="${sessionScope.groups}" var="group">
						<option>${group.paramValue}</option>
					</c:forEach>
				</select>

			</td>
			<td>项目进度</td>
			<td>
				<select id="progess"  name="progess">
					<c:forEach items="${params}" var="pa">
						<option value="${pa.paramValue}">${pa.paramValue}</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<td>工作类别</td>
			<td>
				<select id="wType"  name="wType">
					<c:forEach items="${sessionScope.types}" var="type">
						<option value="绿色建筑">${type.paramValue}</option>
					</c:forEach>
				</select>
			</td>
			<td>项目名称</td>
			<td><input type="text" name="wName" id="wname"/></td>
		</tr>
		<tr>
			<td>开始时间</td>
			<td><input type="date" name="sTime" id="stime"/></td>
			<td>完成时间</td>
			<td><input type="date" name="eTime" id="etime"/></td>
		</tr>
		<tr>
			<td>项目情况</td>
			<td ><textarea cols="30" name="pdetail" id="detail"></textarea></td>
			<td>项目负责人</td>
			<td>
				<select id="leader" name="leader">
					<option id="option" value="">---请选择---</option>
					<c:forEach items="${sessionScope.users}" var="user">
						<option id="option">${user.name}</option>
					</c:forEach>
				</select>
            </td>
		</tr>
		<tr>
			<td>审核人</td>
			<td> <%--<input type="text" name="checker" id="checker"/> </td>--%>
				<select id="checker" name="checker">
					<option id="option" value="">---请选择---</option>
					<c:forEach items="${sessionScope.users}" var="user">
						<option id="option">${user.name}</option>
					</c:forEach>
				</select>
			</td>
			<td>客户负责人</td>
			<td> <%--<input type="text" name="kehuer" id="kehuer"/> </td>--%>
				<select id="kehuer" name="kehuer">
					<option id="option" value="">---请选择---</option>
					<c:forEach items="${sessionScope.users}" var="user">
						<option id="option">${user.name}</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<td>订阅人</td>
			<td>
				<select id="others1" name="others1" class="selectpicker bla bla bli" multiple data-live-search="true">
					<optgroup label="">
						<c:forEach items="${sessionScope.customerList}" var="c">
							<option id="option">${c.cname}</option>
						</c:forEach>
					</optgroup>
				</select>
			</td>
			<%--<td>其他2</td> 其他2不显示--%>
			<%--<td> <input type="text" name="others2" id="others2"/> </td>--%>
		</tr>
		<tr>
			<td>备注说明</td>
			<td> <input type="text" name="remarks" id="remarks"/> </td>
		</tr>

<%--		<c:forEach var="c" items="${column}" varStatus="status">
			<c:if test="${status.index==0}">
				<tr>
			</c:if>
			<c:if test="${status.index%2==0}">
				</tr>
			</c:if>
			<td>${c.prop}</td>
			<td><input type="text" name="newColumn" /><input type="hidden" name="proitid" value="${c.id}"></td>
			&lt;%&ndash;<td></td>&ndash;%&gt;
		</c:forEach>--%>
		<tr><td><input type="hidden" name="customerId" value=""></td></tr>
		<tr><td><input type="hidden" name="updateUser" value="${sessionScope.user.name}"></td></tr>
	</table>
	<div class="new_tj">
		<input class="ok" type="button" value="提交" onclick="javaScript:insert()"/>
		<a class="return" href="/showAll" >返回</a>
	</div>
</form>
</body>
</html>
